package com.yoga.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yoga.model.Admin;
import org.apache.ibatis.annotations.Mapper;

/**
 * @author yan
 * @date 2025/8/18
 */
@Mapper
public interface AdminMapper extends BaseMapper<Admin> {
    default Page<Admin> findAll(Page<Admin> page, Admin admin){
        LambdaQueryWrapper<Admin> queryWrapper = Wrappers.lambdaQuery(admin);
        return this.selectPage(page, queryWrapper);
    }
    default Admin findByUsername(String username){
        LambdaQueryWrapper<Admin> qw = Wrappers.lambdaQuery();
        qw.eq(Admin::getUsername,username);
        return this.selectOne(qw);
    }
}
